class Solution {
public:
    void moveZeroes(vector<int>& nums) {
        move(nums, 0);
    }
    void move(vector<int>& nums, int start) {
        int first_zero = -1;
        for (int i = start; i < nums.size(); i++)
        {
            // cout<<"enter loop "<< i <<endl;
            if(nums[i] == 0)
            {
                // cout<<"if"<<endl;
                if(first_zero == -1)
                {
                    first_zero = i;
                    // cout<<"shezhi "<<i<<endl;
                }
            }
                
            else
            {
                // cout << "else"<<endl;
                if(first_zero != -1)
                {
                    // cout<<"swap"<<endl<<i<<endl<<first_zero<<endl<<endl;
                    swap(nums[i], nums[first_zero]);
                    move(nums, first_zero + 1);
                    return;
                }
            }
                
        }
    }
};
